<!-- Example table -->
<div class="container_12"> 
    <div class="module">
        <h2><span><?php echo $_title; ?></span></h2>
        <div class="module-body">
            <div style="margin-top:13px;">
                <?php
                if(isset($errMsg)){?>
                    <span class="notification"><?php echo $_MESSESGE[$errMsg];?></span>
                <?php }?>
			</div>
                        
            <form id="adminForm" name="admin_frm" action="" method="post" enctype="multipart/form-data">
				<p id="subsub_category">
                    <label>Category: <strong>
                    <?php echo $subsubcat['name'];?></strong>
                    <input type="hidden" value="<?php echo $subsubcat['id'];?>" name="category_id" id="category_id"></label>
                    <!-- <select class="input-short" id="category_id" name="category_id">
                        <option value="">Select Category</option> 
                        <?php 
                            /*foreach( $sub_sub_categories as $catrow) {
                                $sel = $result['category_id']==$catrow['id'] ? 'selected' : '' ;
                                echo '<option value="'.$catrow['id'].'" '.$sel.'>'.$catrow['name'].'</option>';                            
                            }*/
                        ?>
                    </select> -->
                </p>
                <p>
					<label>Attribute Name</label>
					<div id="availability_info"></div>
					<input type="text" class="input-short check_availability" name="name" id="name" value="<?php echo $result['name'];?>" />
					<!--  <span class="notification-input ni-correct">This is correct, thanks!</span> -->
				</p>  
				<p>
					<label>Description</label>
					<?php $editor->editor('description', $result['description']) ;?>
				</p>
				<fieldset>
					<input type="hidden" class="input-short" name="id" value="<?php echo $result['id'];?>" />
					<input class="submit-green" type="submit" name="submit" value="Submit" /> 
					<input class="submit-gray" type="button" value="Cancel" onclick="javascript: window.location='<?php echo _SITE_ADMIN_URL_?>'+'product/product_attribute_mng.php';" />
				</fieldset>
			</form>
		</div> <!-- End .module-body -->
	</div>  <!-- End .module -->
</div>
<div style="clear:both;"></div>
<script>
	var root_path = '<?php echo _SITE_ADMIN_URL_?>';
	var table = 'category_attributes';
	var field = 'name';
	var item_col = 'id';
    var item_value = '<?php echo $_REQUEST['id'];?>';
	$().ready(function() {
        
        $('#name').bind('keyup change keydown', function(){
            var field_value = $(this).val();
            path = root_path+'ajax/getGeo.php?type=check_availability&table='+table+'&field='+field+'&field_value='+field_value+'&item_col='+item_col+'&item_value='+item_value;
            $.ajax({url: path,    
                success: function(response) {
                    $('#availability_loading').hide();
                    $('#availability_info').html(response);
                }
            });
        });
        
		$("#adminForm").validate({
			rules: {
				name: "required",
				description: "required",
                category_id: "required"
			 },
			messages: {
				name: "Please enter product attribute name",
				description: "Please enter product attribute description",
                category_id: "Please select category"
			}
		});
	});
</script>
